package com.example.stringbufferlogger.VO;

import com.alibaba.fastjson.JSONObject;

import java.util.LinkedHashMap;
import java.util.Map;

public  class ComparisonResult {
    private boolean success = true;
    private String errorMessage = "";
    private Map<String, Map<String, Object>> differences = new LinkedHashMap<>();

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
        this.success = false;
    }

    public Map<String, Map<String, Object>> getDifferences() {
        return differences;
    }

    public boolean isDifferences(){
        return !differences.isEmpty();
    }
    public String  getDifferencesStr(){
        if(isDifferences()){
            return JSONObject.toJSONString(differences).replaceAll("\\\\\"","");
        }
        return null;
    }

}
